{% extends "admin.html" %}
{% block content %}
    <div class="well">
	<h1>节点运行状态</h1>
	
		<table class="table table-bordered table-striped">
		    <tr>
			<td>在线用户</td>
            <td>{{ records|length }}</td>
		    </tr>
		    <tr>
			<td>今日流量</td>
            <td>{{ todaybandwidth|filesizeformat }}</td>
		    </tr>
		    <tr>
			<td>本月流量</td>
            <td>{{ thismonthbandwidth|filesizeformat }}</td>
		    </tr>
		</table>
	
	<hr>
	<h2>在线用户</h2>
	
		<table class="table table-bordered table-striped table-condensed">
		    <thead>
			<tr>
			    <th>连接时间</th>
			    <th>持续时间</th>
			    <th>流量</th>
			    <th>客户端IP</th>
			    <th>连接方式</th>
			    <th>帐号</th>
			    <th>操作</th>
			</tr>
		    </thead>
            <tbody>
            {% for record in records %}
			<tr>
                <td>{{ record.ConnTime }}</td>
                <td>{{ record.Duration }}</td>
                <td>{{ record.Bandwidth|filesizeformat }}</td>
                <td>{{ record.IP }}</td>
                <td>{{ record.Service }}</td>
                <td><a href="userinfo/{{ record.User.Username }}">{{ record.User.Username }}</a></td>
                <td><a href="api/kill/{{ record.Service }}/{{ record.IP }}" class="btn btn-danger">踢</a></td>
            </tr>
            {% endfor %}
		    </tbody>
		</table>
    </div>
{% endblock %}
